#include "widget.h"
#include "ui_widget.h"
#include <QHBoxLayout>
#include <QTabWidget>
#include "form.h"
#include <QDebug>
#include <QTabBar>
#include "form.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QHBoxLayout* lay = new QHBoxLayout(this);
    //setLayout(lay);


    QTabWidget *pTabWidget = new QTabWidget(this);
    pTabWidget->setTabsClosable(true);
    pTabWidget->setMovable(true);
   pTabWidget->setTabPosition(QTabWidget::North);
    pTabWidget->setTabShape(QTabWidget::Rounded);  //梯形tab

    QWidget *w1 = new QWidget;
    w1->setStyleSheet("background-color:rgb(54,54,54)");
    QWidget *w2 = new QWidget;
     w2->setStyleSheet("background-color:rgb(54,154,54)");
    QWidget *w3 = new QWidget;
     w3->setStyleSheet("background-color:rgb(54,54,154)");

    pTabWidget->insertTab(0, w1, "tab1");
     pTabWidget->insertTab(1, w2, "tab2");
    pTabWidget->insertTab(2, w3, "tab3");

     lay->addWidget(pTabWidget);

    Form* f = new Form;
     pTabWidget->insertTab(3, f, "tab4");

    pTabWidget->setTabToolTip(1," this is tab2");
}

Widget::~Widget()
{
    delete ui;
}
